package com.GainLoop;

import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.app.ListActivity;
import android.content.Intent;

import com.GainLoop.R;


public class GiveGain extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.givegain);
        ListView lv=getListView();
  	    //TODO : gains= getHotGains();
  	  	lv.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, gains));
  	}
    public boolean onCreateOptionsMenu(Menu menu) {
    	Log.v("menu", "inflating menu..");
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        menu.setGroupVisible(R.id.group2, false);
        
        return true;
    }
    public boolean onOptionsItemSelected (MenuItem item){
    	Toast toast;
		 switch (item.getItemId()) {
		    case R.id.profile_button:
		    	Intent intent=new Intent(GiveGain.this,Profile.class);
		    	GiveGain.this.startActivity(intent);
		        return true;
		    case R.id.help_button:
		    	toast = Toast.makeText(GiveGain.this,"help", Toast.LENGTH_LONG);
				toast.show();
		        return true;
		    case R.id.search_button:
		    	onSearchRequested();
		    	return true;
		    case R.id.offers_button:
		    	intent=new Intent(GiveGain.this,GetGain.class);
		    	GiveGain.this.startActivity(intent);
				return true;
		    case R.id.addOffer_button:
		    	intent=new Intent(GiveGain.this,AddRequest.class);
		    	GiveGain.this.startActivity(intent);
            	return true;
		    default:
		        return super.onOptionsItemSelected(item);
		    }
		
    	
    }
  static final String[] gains = new String[] {
      "gain1", "gain2", "gain3", "gain4", "gain5","gain6","gain7","gain8"
      
    };
}